home *** CD-ROM | disk | FTP | other *** search
/ Champak 123 / (Vol 123) Jan 13 2011.iso / Games / island_fishing.swf / scripts / DefineSprite_226 / frame_1 / DoAction.as
Text File  |  2011-01-13  |  708b  |  39 lines

  1. acceleration = 150;
  2. newpos = function()
  3. {
  4.    ranx = Math.round(Math.random() * 550);
  5.    rany = Math.round(Math.random() * 400);
  6. };
  7. newpos();
  8. this.onEnterFrame = function()
  9. {
  10.    if(hooked <= 0)
  11.    {
  12.       if(ranx > this._x)
  13.       {
  14.          this._xscale = -100;
  15.       }
  16.       if(ranx < this._x)
  17.       {
  18.          this._xscale = 100;
  19.       }
  20.       this._x += (ranx - this._x) / acceleration;
  21.       if(this._y > 190)
  22.       {
  23.          this._y += (rany - this._y) / acceleration;
  24.          if(rany <= 175)
  25.          {
  26.             newpos();
  27.          }
  28.       }
  29.       else
  30.       {
  31.          this._y += 1;
  32.       }
  33.       if(_root.move >= 1)
  34.       {
  35.          newpos();
  36.       }
  37.    }
  38. };
  39.